#include <header.h>

int main(){

    DIR * dir = opendir("/home/snow/3th/04_Linux/CODE/Day15");
    ERROR_CHECK(dir, NULL, "opendir");


    struct dirent * dt = readdir(dir);
    printf("file_name: %s \n", dt->d_name);
    
    // 记录当前位置
    long  tag = telldir(dir);

    dt = readdir(dir);
    printf("file_name: %s \n", dt->d_name);

    dt = readdir(dir);
    printf("file_name: %s \n", dt->d_name);

    dt = readdir(dir);
    printf("file_name: %s \n", dt->d_name);

    // 重新回到之前的标记位置
    //seekdir(dir, tag);

    rewinddir(dir);
    
    dt = readdir(dir);
    printf("file_name: %s \n", dt->d_name);


    closedir(dir);
    return 0;
}

